<template>
    <div>
        <el-card>
            <el-tabs v-model="activeName" @tab-click="handleRouter">
                <el-tab-pane label="ACM排名" name="ACM Rank">
                    <router-view v-if="activeName === 'ACM Rank'"></router-view>
                </el-tab-pane>
                <el-tab-pane label="OI排名" name="OI Rank">
                    <router-view v-if="activeName === 'OI Rank'"></router-view>
                </el-tab-pane>
            </el-tabs>
        </el-card>
    </div>
</template>

<script>

export default {
    name: 'Rank',
    data() {
        return {
            activeName: 'ACM Rank',
        };
    },
    mounted() {
        this.activeName=this.$route.name;
        this.$router.push({name: this.activeName});
    },
    methods: {
        handleRouter(tab) {
            let name = tab.name;
            if (name !== this.$route.name) {
                this.$router.push({ name: name });
            }
        }
    }
}
</script>

<style scoped>

</style>
